/**
 * 增减字符串匹配
 *
 * @USER: Administrator
 * @DATE: 2024/9/21 上午11:10
 * @VERSION: 1.0.0
 */
public class LC942 {
    public static void main(String[] args) {

    }

    public int[] diStringMatch(String s) {
        int n = s.length(),low=0,high=n;
        int[] res = new int[n+1];
        for (int i = 0; i < n; i++) {
            res[i] = s.charAt(i)=='I'?low++:high--;
        }
        res[n] = low;
        return res;
    }

}
